
int cmp(int* a, int* b)
{
    return *a - *b;
}

int findContentChildren(int* g, int gSize, int* s, int sSize) {
    int sum = 0;
    qsort(g, gSize, sizeof(int), cmp);
    qsort(s, sSize, sizeof(int), cmp);
    int n = 0;
    for (int i = 0, j = 0; i < gSize && j < sSize; i++, j++)
    {
        while (j<sSize && g[i]>s[j])
        {
            j++;
        }
        if (j < sSize)
        {
            sum++;
        }

    }
    return sum;
}